/*
 * AR1511_NMEA.h
 *
 *  Created on: Dec 17, 2010
 *      Author: root
 */

#ifndef AR1511_NMEA_H_
#define AR1511_NMEA_H_

//#define iCVType() CONFIG.iCVType==0?"Master":"Slave"

typedef struct NMEA_STRUCT_MSG_
{
	unsigned int err_cnt;
} NMEA_STRUCT_MSG;


typedef struct NMEA_STRUCT_MSG_MON_
{
	NMEA_STRUCT_MSG gpgga;
	NMEA_STRUCT_MSG gpzda;
	NMEA_STRUCT_MSG gpgsv;
} NMEA_STRUCT_MSG_MON;

extern void nmea_msg_reset(void);
//extern void nmea_msg_monitor(void);
//extern void nmea_msg_send(unsigned char* buf, int size, int urgent);
//extern int nmea_msg_rcvd(unsigned char* buf, int offset, int len);
//extern void nmea_unpack_gpgga(char** tokens);
//extern void nmea_unpack_gpzda(char** tokens);
//extern void nmea_unpack_gpgsv(char** tokens, int max_tokens);

void nmea_msg_monitor(void);
void nmea_msg_send( char* buf, int size, int urgent);
int nmea_msg_rcvd( char* buf, int offset, int len);
int nmea_crc_validate(unsigned char* buf, int offset, int len);
void nmea_unpack_gpgga(char** tokens, int max_tokens);
void nmea_unpack_gpzda(char** tokens, int max_tokens);
void nmea_unpack_gpgsv(char** tokens, int max_tokens);
void nmea_unpack_gpgsa(char** tokens, int max_tokens);

//extern void CheckARLock();
extern void CheckF1000cLock();
extern char gpgga_fix;
extern NMEA_STRUCT_MSG_MON nmea_mon;

extern int ar1511_model_cnt;
extern int bRcvTypeF1000c;

//extern int bRcvZDA;

typedef struct{
	int i;
	char *str;
}cmdNMEA_;

enum nmaCmdDefine{
	nmeaOutput=0
	,nmeaResetAll
	,nmeaResetCold
	,nmeaResetWarm
	,nmeaResetHot
	,nmeaEnd
};
void SendCommandToF1000c(int cmd);
void SendStringToF1000c(char *s);
int nmea_unpack_gpdtm(char** tokens, int max_token);
int SendNmeaToF1000c(char *s1);
void ForceEBRun();
void ForceGPSTracked();
void ForceGPSUnTracked();
#endif /* AR1511_NMEA_H_ */
